Skip to content

fix(files-eic): silence ssh known-hosts warning that 500'd Hermes config load - #2822

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
fix/files-eic-ssh-warning
May 5, 2026
Merged

HongmingWang-Rabbit merged 1 commit into
stagingfrom
fix/files-eic-ssh-warning

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

User-reported bug

`GET /workspaces/cfc1fd02.../files/config.yaml` on hongming.moleculesai.app's Hermes workspace returned 500 with body:
```
ssh cat: exit status 1 (Warning: Permanently added '[127.0.0.1]:37951' (ED25519) to the list of known hosts.)
```

Root cause

ssh emits the "Permanently added" notice on every fresh tunnel connection, even with `UserKnownHostsFile=/dev/null` (that prevents persistence, not the warning). It lands on stderr, fooling `readFileViaEIC`'s file-not-found classifier:
```go
if len(out) == 0 && stderr.Len() == 0 {
return nil, os.ErrNotExist // → 404
}
return nil, fmt.Errorf("ssh cat: %w (%s)", runErr, ...) // → 500
```
stderr was non-empty (the warning), so we returned the wrapped error → 500 from the HTTP layer instead of 404.

Fix

Add `-o LogLevel=ERROR` to BOTH `writeFileViaEIC` and `readFileViaEIC` ssh invocations. Silences info+warning while keeping real auth/tunnel errors visible (those emit at ERROR level).

Test

`TestSSHArgs_LogLevelErrorBothSites` pins the flag in both blocks via source regex match. Mutation-tested: stripping the flag from the source fails the gate.

Sibling to my earlier #2785 (the ReadFile via SSH-EIC PR that introduced the classifier).

…fig load

GET /workspaces/:id/files/config.yaml on hongming.moleculesai.app's
Hermes workspace returned 500 with body:

  ssh cat: exit status 1 (Warning: Permanently added '[127.0.0.1]:37951'
   (ED25519) to the list of known hosts.)

Root cause: ssh emits the "Permanently added" notice on every fresh
tunnel connection, even with UserKnownHostsFile=/dev/null (that
prevents persistence, not the warning). It lands on stderr, fooling
readFileViaEIC's classifier:

  if len(out) == 0 && stderr.Len() == 0 {
      return nil, os.ErrNotExist
  }
  return nil, fmt.Errorf("ssh cat: %w (%s)", runErr, ...)

stderr was non-empty (the warning), so we returned the wrapped error
→ 500 from the HTTP layer instead of 404.

Fix: add `-o LogLevel=ERROR` to BOTH writeFileViaEIC and readFileViaEIC
ssh invocations. Silences info+warning while keeping real auth/tunnel
errors visible (those emit at ERROR level).

Test: TestSSHArgs_LogLevelErrorBothSites pins the flag in both blocks.
Mutation-tested: stripping the flag from one site fails the gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue May 5, 2026
Merged via the queue into staging with commit b851cfc May 5, 2026
22 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the fix/files-eic-ssh-warning branch May 5, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant